package com.zw.yzk.kabu.management;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.zw.yzk.kabu.data.cache.db.DataBaseManager;
import com.zw.yzk.kabu.im.IMUtils;
import com.zw.yzk.kabu.jpush.JPushHelper;
import com.zw.yzk.kabu.management.ActivityManager;
import com.zw.yzk.kabu.view.activity.LoginActivity;

/**
 * Created by zhanwei on 2017/5/8.
 */

public class AppManager {

    /**
     * 退出登录
     *
     * @param context 上下文
     */
    public static void logout(Context context) {
        //清除登录用户
        DataBaseManager.getInstance().clearAllUser();
        //打开登录页面
        context.startActivity(new Intent(context, LoginActivity.class));
        //关闭activity栈中的所有页面
        ActivityManager.getInstance().finishAllActivity();
        //停止极光推送
        JPushHelper.stopPush(context);
        //停止IM
        IMUtils.logout();
    }
}
